Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
A Node.js module for the optimized JavaScript implementation of the MurmurHash algorithms.
The murmurhash npm package is a JavaScript implementation of the MurmurHash algorithm, which is a non-cryptographic hash function suitable for general hash-based lookup. It is known for its speed and simplicity, making it a popular choice for hash table implementations and other applications where fast hashing is required.
Hashing a string
This feature allows you to generate a 32-bit hash from a given string using the MurmurHash3 algorithm. It is useful for creating hash values for strings that can be used in hash tables or for quick comparisons.
const murmurhash = require('murmurhash');
const hash = murmurhash.v3('example string');
console.log(hash); // Outputs a 32-bit hash
Hashing a string with a seed
This feature allows you to generate a 32-bit hash from a given string with an additional seed value. The seed can be used to produce different hash values for the same input string, which can be useful in certain applications like randomized algorithms.
const murmurhash = require('murmurhash');
const hash = murmurhash.v3('example string', 12345);
console.log(hash); // Outputs a 32-bit hash with a seed
hash.js is a library that provides various hash functions including SHA, RIPEMD, and more. Unlike murmurhash, which is a non-cryptographic hash function, hash.js includes cryptographic hash functions that are suitable for security-sensitive applications.
xxhashjs is a JavaScript implementation of the xxHash algorithm, which is another fast, non-cryptographic hash function. It is similar to murmurhash in terms of speed and use cases but uses a different algorithm that may produce different hash values for the same input.
The built-in Node.js 'crypto' module provides a variety of cryptographic functionalities, including hash functions like SHA-256, MD5, and more. While it offers more secure hash functions compared to murmurhash, it may not be as fast for non-cryptographic use cases.
NOTE: This is a port of Gary Court's excellent work, to a commonJS module that can be easily included into a node.js project or the browser. I take no credit for the implementation. I am simply making it easier to use for others.
An optimized JavaScript implementation of the MurmurHash algorithms.
These algorithms take a JavaScript string (and a seed), and quickly create a non-cryptographic 32-bit hash from it. And by quick I mean sub-millisecond performance.
More information about these algorithms can be found at:
Install it in your browser:
<script type="text/javascript" src="murmurhash.js"></script>
To support older browsers you need to use TextEncoder polyfill
or in node.js
npm install murmurhash
murmurhash = require('murmurhash')
Both version 2 and 3 of the MurmurHash algorithm are supported:
// generates a v2 hash
murmurhash.v2("some input", "some seed value (optional)")
// generates a v3 hash
murmurhash.v3("some input", "some seed value (optional)")
Copyright (c) 2020 Gary Court, Derek Perez
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
A Node.js module for the optimized JavaScript implementation of the MurmurHash algorithms.
The npm package murmurhash receives a total of 537,850 weekly downloads. As such, murmurhash popularity was classified as popular.
We found that murmurhash demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.